<%@ page import="edu.zhku.web4.common.Constants" %>
<%@ page import="edu.zhku.web4.pojo.User" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>登录</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/layui.css">
    <script src="${pageContext.request.contextPath}/layui/layui.js"></script>
    <style>
        .login {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100%;
            background-size: cover;
            background-color: #009688;
        }

        .title {
            margin: 0 auto 30px auto;
            text-align: center;
            color: #707070;
        }

        .login-form {
            width: 400px;
            border-radius: 6px;
            background: #ffffff;
            padding: 25px 25px 5px 25px;
        }
        #error-msg {
            color: red;
            margin-left: 110px;
            margin-bottom: 20px;
        }
    </style>
</head>
<body>
<%
    User user = (User) session.getAttribute(Constants.USER_SESSION_ID);
    if (user != null) {
        response.sendRedirect(request.getContextPath() + "/index.jsp");
    }
%>
<div class="login">
    <form class="layui-form login-form" action="${pageContext.request.contextPath}/verify-login.jsp" method="post">
        <h3 class="title">用户信息管理系统</h3>
        <div class="layui-form-item">
            <label class="layui-form-label" for="username">用户名</label>
            <div class="layui-input-inline">
                <input type="text" id="username" name="username" required lay-verify="required" placeholder="请输入用户名"
                       autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" for="pwd">密码</label>
            <div class="layui-input-inline">
                <input type="password" id="pwd" name="pwd" required lay-verify="required" placeholder="请输入密码"
                       autocomplete="off" class="layui-input">
            </div>
        </div>
        <div id="error-msg"><b>${error}&nbsp;</b></div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="formDemo">登录</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>
</body>
</html>
